package com.cnebula.uas.sso.idp;

import java.util.Map;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class DelegateIDPFactory implements ApplicationContextAware {
	
	private static Map<String, DelegateIDP> beanMap;  

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		beanMap = applicationContext.getBeansOfType(DelegateIDP.class);
	}
	
	public static DelegateIDP getDelegateIDP(String name){
		return beanMap.get(name);
	}
}
